package zFactory;

import node1.AbstractTask;

import org.eclipse.emf.common.util.EList;
import tin92c01.Tin92c01;
import tin92c01.Tin92c01Factory;
import genArchi.Node;

public class NodeTin92c01 implements NodeInterface {

	/**
	 * Attributes
	 */
	private EList<AbstractTask> l_tasks;
	private boolean enableCreate;
	
	/**
	 * 
	 */
	public NodeTin92c01(EList<AbstractTask> l_tasks, boolean enableCreate) 
	{
		this.l_tasks =  l_tasks;
		this.enableCreate = enableCreate;
	}
	@Override
	public Node createNode() {

		/**/
		Tin92c01 _tin92c01 = Tin92c01Factory.eINSTANCE.createTin92c01();

		/**/
		for (AbstractTask t : l_tasks) {

			/**/
			tin92c01.Task lt = Tin92c01Factory.eINSTANCE.createTask();
//			System.out.println("NodeTin92c, id: " + t.getId());
			lt.setId(t.getId());
			lt.setPeriod(t.getPeriod());
			lt.setWcet(t.getWcet());
			lt.setBlocking(t.getBlocking());
			lt.setDeadline(t.getDeadline());
			

			/**/
			_tin92c01.getTasks().add(lt);
		}
		return _tin92c01;	
	}

	@Override
	public boolean isEnable() {
		return this.enableCreate;
	}

	@Override
	public String getNodeName() {
		return "tin92c01.impl.Tin92c01";
	}

	@Override
	public void update(Node node) {}

}
